<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数据转化</title>
</head>

<body>
  <script>
    // ==和!=比较时，优化转换为number类型，其次是string类型，不会主动转化为boolean类型
    // +号运算符操作时，优化转换为string类型，其次是number类型，不会主动转化为boolean类型
    //  js 灵活
    // 0 '' false
    // undefined null   
    // 1 true 
    // 浅等  默认等于false
    console.log('' == 0)
    console.log(false == 0)
    console.log(undefined == null)

    console.log(1 == true)

    if ("水电费") {
      console.log("我是真的")
    } else {
      console.log("假的")
    }
    const x = "25";
    console.log(+x); // expected output: 25
    let str = '1222'
    console.log(Math.floor(str)) // returns 1222
    str = '2344'
    console.log(str * 1) // expected result: 2344
    str = '1234'
    console.log(~~str) // expected result: 1234
  </script>
</body>

</html>